﻿using DonetSpider.Db;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Web.Pages
{
    public class PrivacyModel : PageModel
    {
        private readonly ILogger<PrivacyModel> _logger;
        [BindProperty]
        public Title Data { get; set; }

        public PrivacyModel(ILogger<PrivacyModel> logger)
        {
            _logger = logger;
        }

        public void OnGet()
        {
        }
        /// 默认 Post
        public IActionResult OnPost()
        {
            Console.WriteLine("-----------------");
            Console.WriteLine(Data);
            if (!ModelState.IsValid)
            {
                return Content("{\"code\":4,\"msg\":\"参数错误\"}", "application/json");
            }
            MovieSpider.Inst.StartNew(Data);
            return Content("创建成功", "application/json");
        }
    }
}
